
<?php get_header(); ?>

	<!-- site-content -->
	<div class="site-content clearfix">
		<div class="main-column">
			<div class="main-content">
				<?php if (have_posts()) :
					while (have_posts()) : the_post(); ?>
					<article class="post page">
						
						<h2><?php the_title(); ?></h2>
						<p class="post-info"><?php the_time('Y/m/d') ?> | by <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php the_author(); ?></a> | 类别
							<?php 
							$categaries = get_the_category();
							$separator = ", ";
							$output =  '';

							if ($categaries) {
								foreach ($categaries as $categary) {
									$output .= '<a href="' . get_category_link($categary->term_id) . '">' . $categary->cat_name . '</a>' . $separator;
								}


								echo trim($output, $separator);

							}
							?>  |
							<?php if ( comments_open() ) : 
								comments_popup_link( '评论内容', '1 条评论', '% 条评论', 'comments-link', '评论被禁用了'); 
							endif; ?> 
							| <i class="i-user">
								<?php if(function_exists('the_views')) { the_views(); } ?>
							</i>
						</p>
						<?php the_content(); ?>
					</article>
						
					<?php endwhile;
				else :
					echo '<p>no content found</p>';
				endif; ?>
			</div>
			<div class="main-last-next">
				<div class="main-last-next-last">
					<?php
					$prev_post = get_previous_post();
					if (!empty( $prev_post )): ?>
					  上一篇：<a title="<?php echo $prev_post->post_title; ?>" href="<?php echo get_permalink( $prev_post->ID ); ?>" rel="prev"><?php echo $prev_post->post_title; ?></a>
					<?php endif; ?>
				</div>
				<div class="main-last-next-next">
					<?php
					$next_post = get_next_post();
					if (!empty( $next_post )): ?>
					  下一篇：<a title="<?php echo $next_post->post_title; ?>" href="<?php echo get_permalink( $next_post->ID ); ?>" rel="next"><?php echo $next_post->post_title; ?></a>
					<?php endif; ?>
				</div>			
				
			</div>

			<div class="main-comments">
				<?php comments_template();  ?> 
			</div>

		</div> <!-- /main-column -->
		<?php get_sidebar(); ?>
		<div style="clear:both;"></div>
	</div><!-- /site-content  -->

<?php get_footer(); ?>
